<html>
<head><meta charset="utf-8"><title>Optimizing cg_clif · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Optimizing.20cg_clif.html">Optimizing cg_clif</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="193808005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Optimizing%20cg_clif/near/193808005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Optimizing.20cg_clif.html#193808005">(Apr 13 2020 at 19:04)</a>:</h4>
<p>While optimizing cg_clif, I noticed that a lot of time is spent in calls from cg_clif to rustc. Especially <code>layout_of</code>, <code>normalize_erasing_late_bound_regions</code>, <code>subst_and_normalize_erasing_regions</code> and <code>const_caller_location</code>. Any ideas how to improve this?</p>
<p>A profile of the codegen part of the compilation of <code>image</code> can be found at: <a href="https://gist.github.com/bjorn3/a23351b1ff7077bbbad203a562cb7c1b" title="https://gist.github.com/bjorn3/a23351b1ff7077bbbad203a562cb7c1b">https://gist.github.com/bjorn3/a23351b1ff7077bbbad203a562cb7c1b</a><br>
The profile can be directly used as input for <code>flamegraph.pl</code> or can be opened in for example speedscope.app (<a href="https://www.speedscope.app/#profileURL=https%3A%2F%2F//gist.githubusercontent.com/bjorn3/a23351b1ff7077bbbad203a562cb7c1b/raw/2ca9718cd87fad15366518d567808fa1190b51f8/perf.collapsed&amp;title=cg_clif_profile_for_image" title="https://www.speedscope.app/#profileURL=https%3A%2F%2F//gist.githubusercontent.com/bjorn3/a23351b1ff7077bbbad203a562cb7c1b/raw/2ca9718cd87fad15366518d567808fa1190b51f8/perf.collapsed&amp;title=cg_clif_profile_for_image">direct link to open the profile</a>).</p>



<a name="193808091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Optimizing%20cg_clif/near/193808091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Optimizing.20cg_clif.html#193808091">(Apr 13 2020 at 19:05)</a>:</h4>
<p>(Focus on <code>codegen_fn_content</code>)</p>



<a name="193808196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Optimizing%20cg_clif/near/193808196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Optimizing.20cg_clif.html#193808196">(Apr 13 2020 at 19:06)</a>:</h4>
<p>There's an issue open for making <code>layout_of</code> a query, which would cache its results</p>



<a name="193808307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Optimizing%20cg_clif/near/193808307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Optimizing.20cg_clif.html#193808307">(Apr 13 2020 at 19:07)</a>:</h4>
<p>Ah nevermind, it's already a query</p>



<a name="193808320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Optimizing%20cg_clif/near/193808320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Optimizing.20cg_clif.html#193808320">(Apr 13 2020 at 19:07)</a>:</h4>
<p>I was thinking of FnAbi <a href="https://github.com/rust-lang/rust/issues/65999" title="https://github.com/rust-lang/rust/issues/65999">https://github.com/rust-lang/rust/issues/65999</a></p>



<a name="193808511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Optimizing%20cg_clif/near/193808511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Optimizing.20cg_clif.html#193808511">(Apr 13 2020 at 19:08)</a>:</h4>
<p>layouts were never not cached</p>



<a name="193808545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Optimizing%20cg_clif/near/193808545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Optimizing.20cg_clif.html#193808545">(Apr 13 2020 at 19:09)</a>:</h4>
<p>even long before the query system or non-codegen parts of rustc knowing about layouts</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>